<?php

declare(strict_types=1);

namespace App\Fastapp\Model;

use Hyperf\Database\Model\Relations\HasOne;
use Mine\MineModel;

/**
 * @property int $id 主键
 * @property int $realname_id 实名id
 * @property int $user_id 用户id
 * @property int $type 1全局
 * @property-read null|FastappRealname $realname
 * @property-read null|Account $account
 */
class AccountRealname extends MineModel
{
    public bool $timestamps = false;
    /**
     * The table associated with the model.
     */
    protected ?string $table = 'account_realname';

    /**
     * The attributes that are mass assignable.
     */
    protected array $fillable = ['id', 'realname_id', 'user_id', 'type'];

    /**
     * The attributes that should be cast to native types.
     */
    protected array $casts = ['id' => 'integer', 'realname_id' => 'integer', 'user_id' => 'integer', 'type' => 'integer'];

    public function realname(): HasOne
    {
        return $this->hasOne(FastappRealname::class, 'id', 'realname_id');
    }

    public function account(): HasOne
    {
        return $this->hasOne(Account::class, 'gene_id', 'user_id');
    }
}
